package be.ad.coffeebreak.web.commands;

import be.ad.coffeebreak.web.Command;
import be.ad.coffeebreak.web.ServiceLocator;
import be.ad.coffeebreak.web.WebConstants;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * A logout command.
 *
 * @author Stefan Bangels
 */
public final class LogoutCommand implements Command {

    protected ServiceLocator serviceLocator;

    /**
     * Default constructor.
     *
     * @param serviceLocator the service locator
     */
    public LogoutCommand(ServiceLocator serviceLocator) {
        this.serviceLocator = serviceLocator;
    }

    @Override
    public String execute(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        request.logout();
        return null;
    }

}